libxl/gentypes.py: don't generate default values
If a field:
0. is not of aggregate type
and
1. is of array type and the array is not empty
or 2. is of a type which has init_val and has been set to init_val,
or 3. is of builtin type and has been set to internal default value,
or 4. is of a type which has no init_val and has been set to 0
then there's no need to generate output for that field in JSON
output.
Note that 0 can result in output like
{
...
FOO : { }
...
}
where FOO is aggregate type but all its fields are set to default, hence
no JSON output in {} at all. This is not pretty, but it's still valid
JSON. And the parser should be able to skip touching those fields in the
resulting C structures. When the parser consumes that generated JSON
object, all default values should be automatically filled in.
Also change some non-zero init_vals to LIBXL_* for better readability in
generated C code.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>